Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platform: Hetzner API implementation #536

Merged
merged 6 commits into from
Aug 27, 2024

Conversation

apricote
Copy link
Contributor

@apricote apricote commented Jun 20, 2024

Add support for the Hetzner Platform to kola and ore.

Usage looks like:

HETZNER_IMAGE_ID=$(./bin/ore \
  hetzner \
  --hetzner-token $(pass hetzner/token) \
  --hetzner-location fsn1 \
  create-image \
  --name flatcar-nightly \
  --file http://bincache.flatcar-linux.net/images/amd64/4011.0.0+nightly-20240624-2100/flatcar_production_hetzner_image.bin.bz2)

./bin/kola \
  --platform hetzner \
  --hetzner-token $(pass hetzner/token) \
  --hetzner-server-type cpx11 \
  --hetzner-location fsn1 \
  --hetzner-image "${HETZNER_IMAGE_ID}"
  run '*'

Copy link
Contributor

@tormath1 tormath1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! It looks good for a first iteration. As said on Matrix, we can see to implement a firewall (or update the default one) to allow connection on port 2379 for example. In api.go or in a network.go file.

EDIT: Just seen your message on Matrix

Only ports 25 & 465 (SMTP) are blocked by default.

platform/api/hetzner/api.go Outdated Show resolved Hide resolved
platform/api/hetzner/api.go Outdated Show resolved Hide resolved
platform/api/hetzner/api.go Show resolved Hide resolved
platform/machine/hetzner/machine.go Outdated Show resolved Hide resolved
cmd/ore/hetzner/create.go Outdated Show resolved Hide resolved
cmd/ore/hetzner/create.go Outdated Show resolved Hide resolved
platform/api/hetzner/api.go Show resolved Hide resolved
cmd/ore/hetzner/create.go Outdated Show resolved Hide resolved
platform/api/hetzner/api.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tormath1 tormath1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the last two nits. Feel free to rearrange your commits as you wish - ideally we could rebase and squash your commits into those commits: https://github.com/flatcar/mantle/pull/533/commits to get one initial commit for the API implementation, one initial commit for the Kola platform implementation and one for the ore part.
I don't have a strong opinion on this, so it's up to you. :)

Tested with Flannel and Kubeadm:

=== RUN   cl.flannel.vxlan
=== RUN   cl.flannel.udp
=== RUN   kubeadm.v1.29.2.calico.base
=== RUN   kubeadm.v1.29.2.calico.base/node_readiness
=== RUN   kubeadm.v1.29.2.calico.base/nginx_deployment
=== RUN   kubeadm.v1.29.2.calico.base/NFS_deployment
--- PASS: cl.flannel.vxlan (208.44s)
        flannel.go:121: ping from 50821554(10.254.14.0) to 50821552(10.254.47.0)
--- PASS: cl.flannel.udp (271.60s)
        cluster.go:125: Timeout occurred while waiting for network connectivity.
        flannel.go:121: ping from 50821692(10.254.9.0) to 50821694(10.254.54.1)
--- PASS: kubeadm.v1.29.2.calico.base (591.11s)
    --- PASS: kubeadm.v1.29.2.calico.base/node_readiness (17.55s)
    --- PASS: kubeadm.v1.29.2.calico.base/nginx_deployment (24.24s)
    --- PASS: kubeadm.v1.29.2.calico.base/NFS_deployment (28.03s)
            cluster.go:125: WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/core/.kube/config
            cluster.go:125: WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/core/.kube/config
            cluster.go:125: WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/core/.kube/config
            cluster.go:125: WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/core/.kube/config
            cluster.go:125: jq: error (at <stdin>:121): Cannot iterate over null (null)
            cluster.go:125: jq: error (at <stdin>:121): Cannot iterate over null (null)
            cluster.go:125: jq: error (at <stdin>:121): Cannot iterate over null (null)
PASS, output in _kola_temp/hetzner-2024-07-24-1113-35472

platform/machine/hetzner/cluster.go Outdated Show resolved Hide resolved
platform/api/hetzner/api.go Outdated Show resolved Hide resolved
@apricote apricote changed the base branch from hetzner to flatcar-master August 5, 2024 17:43
tormath1 and others added 5 commits August 5, 2024 19:48
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
Signed-off-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
Co-authored-by: Julian Tölle <julian.toelle97@gmail.com>
@apricote
Copy link
Contributor Author

apricote commented Aug 5, 2024

  • Squashed all commits into 5 along the lines you suggested and had in [wip] platform: add Hetzner #533.
  • Rebased on current flatcar-master and changed the PR target branch to it.
  • Updated hcloud-go to latest version

All tests besides one work for me with this version. The failing test looks weird to me, in that it tries to parse cloud-init config.

--- FAIL: cl.cloudinit.basic (292.05s)
        cluster.go:125: cat: /foo: No such file or directory
        cluster.go:145: "cat /foo" failed: output , status Process exited with status 1

@tormath1
Copy link
Contributor

tormath1 commented Aug 5, 2024

  • Squashed all commits into 5 along the lines you suggested and had in [wip] platform: add Hetzner #533.

    • Rebased on current flatcar-master and changed the PR target branch to it.

    • Updated hcloud-go to latest version

All tests besides one work for me with this version. The failing test looks weird to me, in that it tries to parse cloud-init config.

--- FAIL: cl.cloudinit.basic (292.05s)
        cluster.go:125: cat: /foo: No such file or directory
        cluster.go:145: "cat /foo" failed: output , status Process exited with status 1

Great, thanks a lot for the cleanup. For the failing test, I suspect it's because the coreos-cloudinit support is not implemented for Hetzner: https://github.com/flatcar/coreos-cloudinit/tree/flatcar-master/datasource/metadata

Flatcar does not ship the "official" cloudinit but a rewriting in Go that implements a subset of the official cloud-init. I think for now we can skip this test and we can still implement the Hetzner cloudinit support later.

diff --git a/kola/tests/misc/cloudinit.go b/kola/tests/misc/cloudinit.go
index 9ef74d541..0abce80a4 100644
--- a/kola/tests/misc/cloudinit.go
+++ b/kola/tests/misc/cloudinit.go
@@ -156,7 +156,8 @@ write_files:
   - path: "/foo"
     content: bar`),
 		Distros:          []string{"cl"},
-		ExcludePlatforms: []string{"qemu-unpriv"},
+		// Hetzner: we need to implement coreos-cloudinit support for Hetzner.
+		ExcludePlatforms: []string{"qemu-unpriv", "hetzner"},
 		// This should run on all clouds
 	})
 	register.Register(&register.Test{

The CI failure is "normal" (here: https://github.com/flatcar/mantle/actions/runs/10253573202/job/28366511620?pr=536) - it's because you pushed from a fork.

coreos-cloudinit does not support Hetzner.
@apricote
Copy link
Contributor Author

Disabled the cloudinit test in 1ce68f9.

Copy link
Contributor

@tormath1 tormath1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this implementation! Looking forward to seeing Flatcar tests running on Hetzner

@tormath1 tormath1 merged commit 6807d6c into flatcar:flatcar-master Aug 27, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants